/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.cggveritas.crewintranet.jms.utils;

import static javassist.CtMethod.ConstParameter.string;

/**
 *
 * @author Alassane
 */
public class ElementIp {
    private String p1;
    private String p2;
    private String p3;
    private String p4;

    public ElementIp() {
        p1 = "127";
        p2 = "0";
        p3 = "0";
        p4 = "1";
    }
    
    public ElementIp(String p1, String p2, String p3, String p4) {
        this.p1 = p1;
        this.p2 = p2;
        this.p3 = p3;
        this.p4 = p4;
    }

    public String getP1() {
        return p1;
    }

    public void setP1(String p1) {
        this.p1 = p1;
    }

    public String getP2() {
        return p2;
    }

    public void setP2(String p2) {
        this.p2 = p2;
    }

    public String getP3() {
        return p3;
    }

    public void setP3(String p3) {
        this.p3 = p3;
    }

    public String getP4() {
        return p4;
    }

    public void setP4(String p4) {
        this.p4 = p4;
    }
    
    public String getAdresseComplet(){
        return p1+"."+p2+"."+p3+"."+p4;
    }
    
    public void setHost(String host){
        if(host!=null){
            String[] partage = host.split("\\.");
            p1 = partage[0];
            p2 = partage[1];
            p3 = partage[2];
            p4 = partage[3];
        }
    }
}
